<template>
	<view>
		
		<view class="container">

			<view class="settings_item">
				<view class="settings_name">
					真实姓名
				</view>
				<input type="text" class="value" placeholder="请输入账户名" v-model="info.account_name">

			</view>
			<view class="settings_item">
				<view class="settings_name">
					支付宝账号
				</view>
				<input type="text" class="value" placeholder="请输入账号" v-model="info.card_number">
			</view>

			<!-- 	<view class="img_title">
				收款二维码
			</view>
			<view class="image_box" @tap="up_img">
				<block v-if="!info.qrcode">
					<image src="../../../../static/user/img_none.png" mode="widthFix" class="up_img"></image>
					收款二维码
				</block>
				<image v-else :src="info.qrcode" mode="widthFix" class="imagee"></image>
			</view> -->

		</view>

		<view class="bottom_box">
			<view class="submit_btn" @click="submit()">

				<text>
					立即提交
				</text>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {
					qrcode: '',
					id: '',
					account_bank: '',
					account_name: '',
					card_number: '',
					id_card: '',
					card_type: '',
					bank_code: '',
					is_default: '',
					bank_logo: '',
					card_number_i: '',
					card_type_i: '',
					mobile: ''
				},
				//3微信 4支付宝
				type: 4
			}
		},
		onLoad(options) {
			this.type = options.type;
			// if (this.type == 3) {
			// 	uni.setNavigationBarTitle({
			// 		title: '微信信息'
			// 	})
			// } else {
			// 	uni.setNavigationBarTitle({
			// 		title: '支付宝信息'
			// 	})
			// }
			let data = {
				type: this.type
			}
			this.$api.getUserCollectInfo(data, res => {
				if (res.status) {
					this.info = res.data
				}
			})
		},

		methods: {
			up_img: function() {
				this.$api.uploadFiles(res => {
					if (res.status) {
						this.info.qrcode = res.data.url
					}
				})
			},

			submit: function() {
				this.info.type = this.type;
				if (this.id) {
					this.$api.editThird(this.info, res => {
						if (res.status) {
							this.$common.successToShow(res.msg, res => {
								uni.navigateBack({})
							})
						} else {
							this.$common.errorToShow(res.msg)
						}
					})

				} else {
					//添加
					this.$api.addThird(this.info, res => {
						if (res.status) {
							this.$common.successToShow(res.msg, res => {
								uni.navigateBack({})
							})
						} else {
							this.$common.errorToShow(res.msg)
						}
					})

				}
			}
		}
	}
</script>

<style>
	.imagee {
		width: 400rpx;
	}

	.up_img {

		width: 62rpx;
		height: 53rpx;
		margin-bottom: 20rpx;
	}

	.image_box {
		width: 100%;
		border-radius: 30rpx;
		background-color: #212327;
		padding: 60rpx 0;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		font-size: 24rpx;
		color: #fff;
		line-height: 33rpx;
	}

	.img_title {
		width: 100%;
		padding-left: 24rpx;
		font-size: 32rpx;
		font-weight: bold;
		color: #fff;
		padding-top: 7rpx;
		padding-bottom: 26rpx;
	}
</style>
<style>
	@import url('/pages/user/settings/settings.css');
</style>
